<?php
require_once 'Junction/Clause.php';

class Junction_Clause_Where implements Junction_Clause {
	
	private $_condition;
	private $_params;
	
	public function __construct($expression, array $params = null) {
		$this->_condition = $expression;
		$this->_params = array();
		if (isset($params)) {
			$this->_params = $params;
		}
	}
	
	/**
	 * @return String
	 */
	public function toSql() {
		return (strlen($this->_condition) > 0) ? ' WHERE ' . $this->_condition : '';
	}
	
	/**
	 * @return array
	 */
	public function getParameters() {
		return $this->_params;
	}
	
	/**
	 * @return String
	 */
	public function __toString() {
		return $this->toSql();
	}
}
?>